Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement leaderelection type getter via restmapper #1

Closed
wants to merge 1 commit into from

Conversation

mszostok
Copy link
Owner

@mszostok mszostok commented Sep 21, 2019

Description

This PR is just draft to show the implementation of leaderelection type getter via restmapper. With such implementation we are not calling the api-sever to get all supported groups

@@ -36,6 +36,9 @@ import (
func NewDiscoveryRESTMapper(c *rest.Config) (meta.RESTMapper, error) {
// Get a mapper
dc := discovery.NewDiscoveryClientForConfigOrDie(c)

// TODO(mszostok): here we have useful info about all supported groups and resource
// in api-server
gr, err := restmapper.GetAPIGroupResources(dc)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we have info about all supported groups that we could use for checking if Lease is available, but it's not exposed, so I decided to use the RESTMapping method from mapper and assert error via IsNoMatchError

@mszostok mszostok force-pushed the alternative-ver branch 2 times, most recently from b671ff2 to 1fe47fc Compare September 21, 2019 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant